<?php

/**
 * AimProduct form.
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Hindua88
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class AimProductForm extends BaseAimProductForm
{
  public function configure()
  {      
    unset($this['created_at'], $this['updated_at'], $this['viewer']);
    $src = '/uploads/images/'.$this->getObject()->thumbnail;
    $this->setWidget('thumbnail', new sfWidgetFormInputFileEditableCustom(array(
      'label'    => 'Image',
      'file_src' => $src,
      'is_image' => true,
      'edit_mode' => !$this->isNew(),
      //'template' => '%file% %input% %delete% %delete_label%'
    )));
    
    $path_upload = sfConfig::get('sf_upload_dir').'/images';
    $this->setValidator('thumbnail', new sfValidatorFile(array(
      'required'  => false,
      'path'      => $path_upload,
      'mime_types' => 'web_images'
    )));
    $this->setValidator('image_delete', new sfValidatorPass());
    $this->setWidget('intro', new sfWidgetFormTextArea(array(), array('rows' => 5, 'cols' => 80)));
    $this->setWidget('detail', new sfWidgetFormCKEditor());
    
    $this->setValidator('price', new sfValidatorNumber());
    $this->setValidator('quantity', new sfValidatorNumber());
  }
}
